home *** CD-ROM | disk | FTP | other *** search
- //: C19:stringConvTest.cpp
- // From Thinking in C++, 2nd Edition
- // Available at http://www.BruceEckel.com
- // (c) Bruce Eckel 1999
- // Copyright notice in Copyright.txt
- #include "stringConv.h"
- #include <iostream>
- #include <complex>
- using namespace std;
-
- int main() {
- int i = 1234;
- cout << "i == \"" << toString(i) << "\"\n";
- float x = 567.89;
- cout << "x == \"" << toString(x) << "\"\n";
- complex<float> c(1.0, 2.0);
- cout << "c == \"" << toString(c) << "\"\n";
- cout << endl;
-
- i = fromString<int>(string("1234"));
- cout << "i == " << i << endl;
- x = fromString<float>(string("567.89"));
- cout << "x == " << x << endl;
- c = fromString< complex<float> >(string("(1.0,2.0)"));
- cout << "c == " << c << endl;
- } ///:~
-